package game.controller;

import game.main.EventHandler;
import javafx.geometry.Bounds;
import javafx.scene.canvas.GraphicsContext;
import javafx.scene.shape.Rectangle;

public class GameObject {

    public static int currentMap;//当前所在地图
    public static final CollisionChecker cChecker = new CollisionChecker();//碰撞检测
    public static final EventHandler eHandler = new EventHandler();
    //定义一个成员变量来重用Rectangle对象
    private static final Rectangle collisionBox = new Rectangle();//new一个在世界中的一个实体矩形

    public int worldX, worldY;//世界的坐标

    public int solidAreaX = 0, solidAreaY = 0, solidAreaWidth = 48, solidAreaHeight = 48;//实心区域

    public int solidAreaBoxX, solidAreaBoxY;//在世界的实体坐标

    public String name;

    public String type;

    public GameObject() {
    }

    public void draw(GraphicsContext gc) {
    }


    public Bounds getRectangle() {
        // 更新碰撞检测区域的位置和尺寸
        collisionBox.setX(solidAreaBoxX);
        collisionBox.setY(solidAreaBoxY);
        collisionBox.setWidth(solidAreaWidth);
        collisionBox.setHeight(solidAreaHeight - 1);
        return collisionBox.getBoundsInLocal();
    }

}
